
//set desired baud rate
#define BAUDRATE 4800

//calculate UBRR value
#define UBRRVAL ((F_CPU/(BAUDRATE*16UL))-1)

#define RX_PACKET_SIZE 3

#define RX_STATE_SYNC		0
#define RX_STATE_RCV		1
#define RX_STATE_DONE		2

extern uint8_t serialaddr;          // protocol address

//RXC ISR variables                                                             
extern uint8_t r_index;          // current packet byte index
extern uint8_t r_buffer[RX_PACKET_SIZE]; // input packet
extern uint8_t r_ready;          //flag for receive done
extern uint8_t r_char;           //current character  
extern uint8_t r_state;           //current character  

void serial_init(void);
void rcv_int(void);

